import 'dart:convert';

import '../model/log.dart';
import 'index.dart';

/// 生成格式日志的pipe
void formatNormalLogPipe(List<NormalLog> logs, Resolve resolve) {
  List<NormalLog> formatedLog = [];
  for (NormalLog log in logs) {
    formatedLog.add(NormalLog(
        msg: log.msg is String ? log.msg : jsonEncode(log.msg),
        level: log.level,
        ext1: log.ext1,
        ext2: log.ext2,
        ext3: log.ext3));
  }
  resolve(formatedLog);
}
